﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.IO;

namespace WcfService_Restful
{    
    [ServiceContract]
    [XmlSerializerFormat]
    public interface IService1
    {
        [OperationContract]
        [WebGet(UriTemplate = "GetLocation", ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare)]
        DTO.DuLieu_DTO []GetLocation();

        [OperationContract]
        [WebGet(UriTemplate = "SearchLocation/{MaQuan}/{MaPhuong}", ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare)]
        DTO.DuLieu_DTO[] SearchLocation(String MaQuan, String MaPhuong);

        [OperationContract]
        [WebGet(UriTemplate = "GetDistrict", ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare)]
        DTO.QuanHuyen_DTO[] GetDistrict();

        [OperationContract]
        [WebGet(UriTemplate = "GetWard", ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare)]
        DTO.Phuong_DTO[] GetWard();        

        //[OperationContract]
        //[WebInvoke(UriTemplate = "DeleteLocation/{MaDuLieu}", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare)]
        //void DeleteLocation(String MaDuLieu);

        [OperationContract]
        [WebInvoke(UriTemplate = "/InsertLocation/", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare)]
        void InsertLocation(Stream s);

        [OperationContract]
        [WebInvoke(UriTemplate = "/UpdateLocation/", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare)]
        void UpdateLocation(Stream s);

        [OperationContract]
        [WebInvoke(UriTemplate = "/DeleteLocation/", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare)]
        void DeleteLocation(Stream s);
    }
    
    [DataContract]
    public class CompositeType
    {
        bool boolValue = true;
        string stringValue = "Hello ";

        [DataMember]
        public bool BoolValue
        {
            get { return boolValue; }
            set { boolValue = value; }
        }

        [DataMember]
        public string StringValue
        {
            get { return stringValue; }
            set { stringValue = value; }
        }
    }
}
